{php}
    $firstrun = input('param.firstrun/d', 0);
    $admin_1664260942_arr = cookie('admin-1664260942-arr');
    $admin_1664260942_arr = json_decode($admin_1664260942_arr);
    if (1 == $firstrun) {
        $admin_1664260942_arr = null;
    }
{/php}
<div class="sidebar-second order-navBox">
    <ul id="accordion" class="accordion">
        {eq name="'Member@users_index'|is_check_access" value="1"}
        <li data-value="1" {if null === $admin_1664260942_arr || in_array(1, $admin_1664260942_arr)}class="open"{/if}>
            <a class="link">会员管理<i class="fa fa-angle-right"></i></a>
            <ul class="submenu" {if is_array($admin_1664260942_arr) && !in_array(1, $admin_1664260942_arr)}style="display: none;"{/if}>
                <li>
                    <a {if condition="in_array($Think.const.ACTION_NAME, ['users_index','users_edit'])"}class="current"{/if} href='{:url("Member/users_index")}'>会员列表</a>
                </li>
                <li><a {if condition="in_array($Request.action, ['level_index','level_add','level_edit'])"}class="current"{/if} href='{:url("Level/level_index")}'>会员等级</a></li>

            </ul>
        </li>
        {/eq}
        {eq name="'UsersMoneyRechargeType@index'|is_check_access" value="1"}
        <li data-value="2" {if null === $admin_1664260942_arr || in_array(2, $admin_1664260942_arr)}class="open"{/if}>
            <a class="link">会员充值<i class="fa fa-angle-right"></i></a>
            <ul class="submenu" {if is_array($admin_1664260942_arr) && !in_array(2, $admin_1664260942_arr)}style="display: none;"{/if}>
                <li><a {if condition="'UsersMoneyRechargeType' == $Think.const.CONTROLLER_NAME"}class="current"{/if} href='{:url("UsersMoneyRechargeType/index")}'>充值活动</a></li>
                <li><a {if condition="'UsersMoney' == $Think.const.CONTROLLER_NAME"}class="current"{/if} href='{:url("UsersMoney/eyou_money_recharge_index",['cause_type'=>-1])}'>余额明细</a></li>
            </ul>
        </li>
        {/eq}
        {eq name="'UsersScore@index'|is_check_access" value="1"}
            {if condition="$php_servicemeal >= 20"}
            <li data-value="3" {if null === $admin_1664260942_arr || in_array(3, $admin_1664260942_arr)}class="open"{/if}>
                <a class="link">会员积分<i class="fa fa-angle-right"></i></a>
                <ul class="submenu" {if is_array($admin_1664260942_arr) && !in_array(3, $admin_1664260942_arr)}style="display: none;"{/if}>
                    <li><a {if condition="in_array($Request.action, ['conf'])"}class="current"{/if} href='{:url("UsersScore/conf")}'>积分设置</a></li>
                    <li><a {if condition="'UsersScore' == $Think.const.CONTROLLER_NAME && in_array($Request.action, ['index'])"}class="current"{/if}  href='{:url("UsersScore/index")}'> 积分明细 </a> </li>
                </ul>
            </li>
            {/if}
        {/eq}

    </ul>
</div>

<script>
    $(function() {

        openClose();

        $('#accordion > li > a.link').click(function() {
            var $this = $(this);
                $parent = $this.parent();
                $next = $this.next();
            $next.slideToggle();
            $parent.toggleClass('open');
            openClose();
        });

        function openClose()
        {
            var arr = [];
            var className = '';
            $('#accordion > li').each(function(index, item){
                className = " " + $(item).attr('class') + " ";
                if (-1 < className.indexOf(' open ')) {
                    arr.push($(item).data('value'));
                }
            });
            arr = JSON.stringify(arr);
            setCookies('admin-1664260942-arr', arr);
        }
    });
</script>
